package com.hboxs.asl.controller.app.product;

import com.hboxs.asl.JsonMessage;
import com.hboxs.asl.controller.app.BaseController;
import com.hboxs.asl.entity.*;
import com.hboxs.asl.service.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;

@Controller(value = "appIOSPointControl")
@RequestMapping(value = "/app/iosPoint")
public class IOSPointControl extends BaseController {

    @Resource(name = "globalConfigServiceImpl")
    private GlobalConfigService globalConfigService;

    /**
     * 记录
     * @return
     */
    @RequestMapping(value = "/config", method = RequestMethod.GET)
    @ResponseBody
    public JsonMessage config() {
        GlobalConfig globalConfig = globalConfigService.getUniqueness();

        List<IOSConfig> iosConfigList = globalConfig.getIosConfigs();

        return JsonMessage.success(

                "payShow", globalConfig.getPayShow(),

                "percentage", globalConfig.getPercentage(),

                "iosConfigList", JsonMessage.optimiseObj(iosConfigList, "pid", "price")
        );
    }

}
